
#if !SILVERLIGHT
using QdbUnit;
using Qdb;
using Qdb.CS;
using Qdb.CS.Config;
using Qdb.Tests.Common.Api;

namespace Qdb.Tests.Common.Api
{
	public class QdbClientServerTestCase : TestWithTempFile
	{
		public virtual void TestClientServerApi()
		{
			IServerConfiguration config = QdbClientServer.NewServerConfiguration();
			IObjectServer server = QdbClientServer.OpenServer(config, TempFile(), unchecked(
				(int)(0xdbdb)));
			try
			{
				server.GrantAccess("user", "password");
				IClientConfiguration clientConfig = QdbClientServer.NewClientConfiguration();
				IObjectContainer client1 = QdbClientServer.OpenClient(clientConfig, "localhost", 
					unchecked((int)(0xdbdb)), "user", "password");
				try
				{
				}
				finally
				{
					Assert.IsTrue(client1.Close());
				}
			}
			finally
			{
				Assert.IsTrue(server.Close());
			}
		}

		public virtual void TestConfigurationHierarchy()
		{
			Assert.IsInstanceOf(typeof(INetworkingConfigurationProvider), QdbClientServer.NewClientConfiguration
				());
			Assert.IsInstanceOf(typeof(INetworkingConfigurationProvider), QdbClientServer.NewServerConfiguration
				());
		}
	}
}
#endif // !SILVERLIGHT
